home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / ASSEMBLE / 2743.ZIP / WASH1 < prev    next >
Text File  |  1980-01-01  |  4KB  |  126 lines

  1. @OP
  2.  
  3.                   WASHING MACHINE (Version 1)
  4.                   ---------------------------
  5.     This program steps through a sequence to provide the
  6.     program for a typical washing machine.
  7.  
  8.     The washing machine model is connected to real ports
  9.     436 (port A for outputs from CPU) and 437 (port B:
  10.     inputs to CPU). The input/output 8255 control register
  11.     is on port 439.
  12.  
  13.     The model uses just eight bits for the address bus, so
  14.     cannot address those ports directly. By way of Debug
  15.     option L (level) in the model CPU program set model
  16.     ports 6, 7, 8, and 9 to 436, 437, etc, then use model
  17.     port 6 for port A, etc. Once set, these assignments are
  18.     saved to a configuration file which is loaded each time
  19.     the CPU program is executed, so only needs to be set
  20.     once.
  21.  
  22.     The bit assignments on output port A are:
  23.            reverse=1,   go=2,   fast=4,   water=8,
  24.            soap=16,     drain=32,         heat=64.
  25.     Bit assignments on input port B are:
  26.            start=1,  dooropen=2,  empty=4,  full=8.
  27.  
  28.     The assembler code to drive the washing machine might be:
  29.  
  30.                label   opcode operand(s)  comment
  31.                -----   ------ ----------  -------
  32.                ; name and date
  33.  
  34.                ; constants
  35.                portA    equ    6
  36.                portB    equ    7
  37.                controlport equ 9
  38.                start    equ    1
  39.                etc
  40.  
  41.     Note: where one bit only is required in code, use label,
  42.           as with 'full' and 'empty' in subroutines waitfull
  43.           and waitempty.
  44.           Where more than one bit is required,
  45.              either define the combination
  46.                 start&dooropen equ 3
  47.                 then use start&dooropen in place of **
  48.              or put the bit combination in place of **
  49.                 and supplement with comment as shown.
  50.  
  51.     Flowcharts:
  52.     ----------
  53.     Produce flowcharts for
  54.          1: main program
  55.          2: delay subroutine
  56.          3: waitfull subroutine
  57.      and 4: waitempty subroutine.
  58.  
  59.  
  60.  
  61.  
  62.               wash 1  -  disk A26  -  page 1 of 2
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.                      out controlport,131
  72.                                  ; sets up 8255 i/o chip
  73.  
  74.               start2 out portA,0  ; all outputs off
  75.               start3 in a, portB
  76.                      and a, **    ; start + door open
  77.                      cmp a, start ; door should be closed
  78.                      jnz start3
  79.  
  80.                      out portA, ** ; water + soap + go
  81.                      call waitfull
  82.                      mov loopcount,3
  83.  
  84.                loop  out portA, ** ; go + rev + heat
  85.                      call delay
  86.  
  87.                      out portA, go
  88.                      call delay
  89.  
  90.                      dec loopcount
  91.                      jnz loop
  92.  
  93.                      out portA, ** ; drain + go
  94.                      call waitempty
  95.  
  96.                      out portA, ** ; water + go
  97.                      call waitfull
  98.  
  99.                      out portA, ** ; drain + go
  100.                      call waitempty
  101.  
  102.                      out portA, ** ; fast + go + drain
  103.                      call delay
  104.  
  105.                      jmp start2
  106.  
  107.                loopcount ds 1
  108.  
  109.                delay mov a, 4
  110.                delay2 dec a
  111.                      jne delay2
  112.                      ret
  113.  
  114.                waitfull in a,portB ; waits for drum to fill
  115.                      and a,full
  116.                      jz waitfull
  117.                      ret
  118.  
  119.                waitempty in a,portB ; waits for drum to empty
  120.                      and a,empty
  121.                      jz waitempty
  122.                      ret
  123.  
  124.  
  125.               wash 1  -  disk A26  -  page 2 of 2
  126.